package priv.stones.controller.administrate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import priv.stones.common.utils.config.GlobalConfig;
import priv.stones.controller.administrate.shiro.ShiroUtils;
import priv.stones.entity.SysAdmin;
import priv.stones.service.SysAdminService;

/**
 * @Author: Stones
 * @Description:
 * @Date: 2017/10/12 16:32
 */
public abstract class BaseController {

    @Autowired
    protected SysAdminService sysAdminService;

    protected SysAdmin currAdmin() {
        return ShiroUtils.getAdmin();
    }

    /**
     * 模板
     *
     * @param path
     * @param model
     * @return
     */
    public String FreeMarkerViewResult(String path, Model model) {
        String layout = "administrate/shared/layout";
        model.addAttribute("currAdmin", ShiroUtils.getAdmin());
        model.addAttribute("websiteConfig", GlobalConfig.webSite);
        model.addAttribute("body_file_path", "../" + path + ".html");
        return layout;
    }


}
